<template>
  <view class="work-container">

    <!-- 患者信息 -->
    <uni-section title="姓名" type="line">
		<uni-notice-bar single :text="patient.name" />
	</uni-section>
	<uni-section title="住院号" type="line">
		<uni-notice-bar single :text="patient.admissionNumber" />
	</uni-section>
	<uni-section title="操作" type="line"></uni-section>
    <view class="grid-body">
      <uni-grid :column="4" :showBorder="false" @change="changeGrid">
        <uni-grid-item :index="0">
          <view class="grid-item-box">
            <uni-icons type="person-filled" size="30"></uni-icons>
            <text class="text">基本信息</text>
          </view>
        </uni-grid-item>
        <uni-grid-item :index="1">
          <view class="grid-item-box">
            <uni-icons type="staff-filled" size="30"></uni-icons>
            <text class="text">乳腺癌临床特征</text>
          </view>
        </uni-grid-item>
        <uni-grid-item :index="2">
          <view class="grid-item-box">
            <uni-icons type="color" size="30"></uni-icons>
            <text class="text">首次辅助检查</text>
          </view>
        </uni-grid-item>
        <uni-grid-item :index="3">
          <view class="grid-item-box">
            <uni-icons type="settings-filled" size="30"></uni-icons>
            <text class="text">治疗前病理信息</text>
          </view>
        </uni-grid-item>
        <uni-grid-item :index="4">
          <view class="grid-item-box">
            <uni-icons type="heart-filled" size="30"></uni-icons>
            <text class="text">新辅助化疗评估</text>
          </view>
        </uni-grid-item>
        <uni-grid-item :index="5">
          <view class="grid-item-box">
            <uni-icons type="bars" size="30"></uni-icons>
            <text class="text">手术</text>
          </view>
        </uni-grid-item>
        <uni-grid-item :index="6">
          <view class="grid-item-box">
            <uni-icons type="gear-filled" size="30"></uni-icons>
            <text class="text">术后病理</text>
          </view>
        </uni-grid-item>
        <uni-grid-item :index="7">
          <view class="grid-item-box">
            <uni-icons type="chat-filled" size="30"></uni-icons>
            <text class="text">术后治疗情况</text>
          </view>
        </uni-grid-item>
        <uni-grid-item :index="8">
          <view class="grid-item-box">
            <uni-icons type="wallet-filled" size="30"></uni-icons>
            <text class="text">辅助化疗评估</text>
          </view>
        </uni-grid-item>
		<uni-grid-item :index="9">
		  <view class="grid-item-box">
		    <uni-icons type="auth-filled" size="30"></uni-icons>
		    <text class="text">随访信息</text>
		  </view>
		</uni-grid-item>
		<uni-grid-item :index="10">
		  <view class="grid-item-box">
		    <uni-icons type="calendar" size="30"></uni-icons>
		    <text class="text">摘要</text>
		  </view>
		</uni-grid-item>
		<uni-grid-item :index="11">
		  <view class="grid-item-box">
		    <uni-icons type="download" size="30"></uni-icons>
		    <text class="text">附件</text>
		  </view>
		</uni-grid-item>
      </uni-grid>
    </view>
	
  </view>
  
</template>

<script>
  import { getPatient } from "@/api/trms/query"
  export default {
    data() {
      return {
        patientId: null,
		userId: null,
		patient: {}
      }
    },
	onLoad: function(option) {
		console.log("进入页面带入参数：",option.id);
		this.patientId = option.id
		this.userId = option.userId
		this.getPatientById();
	},
    methods: {
	  getPatientById(){
		  getPatient(this.patientId).then(response => {
		    this.patient = response.data;
		  });
	  },
      changeGrid(e) {
		let {index} = e.detail
        this.$modal.showToast('点击了~'+index);
		if(index == 0){
		  this.toPage('patient/edit');
		  return;
		}
		if(index == 1){
		  // 乳腺癌临床特征
		  this.toPage('rxalctz/edit');
		  return;
		}
		if(index == 2){
		  // 首次辅助检查
		  this.toPage('scfzjc/edit');
		  return;
		}
		if(index == 3){
		  // 治疗前病理信息
		  this.toPage('zlqblxx/edit');
		  return;
		}
		if(index == 4){
		  // 新辅助化疗
		  this.toPage('dtpg/xfzhl');
		  return;
		}
		if(index == 5){
		  // 手术
		  this.toPage('ss/edit');
		  return;
		}
		if(index == 6){
		  // 术后病理
		  this.toPage('ssbl/edit');
		  return;
		}
		if(index == 7){
		  // 术后治疗情况
		  this.toPage('shzlqk/edit');
		  return;
		}
		if(index == 8){
		  // 辅助化疗
		  this.toPage('dtpg/fzhl');
		  return;
		}
		if(index == 9){
		  // 随访信息
		  this.toPage('sfxx/index');
		  return;
		}
		if(index == 10){
		  // 摘要信息
		  this.toPage('patient/zhaiyao');
		  return;
		}
		if(index == 11){
		  // 要件信息
		  this.toPage('patient/yjlb');
		  return;
		}
      },
	  toPage(url){
		  uni.navigateTo({
		  			url: '/pages/trms/'+url+'?patientId='+this.patientId+'&userId='+this.userId
		  });
	  }
    }
  }
</script>

<style lang="scss">
  /* #ifndef APP-NVUE */
  page {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background-color: #fff;
    min-height: 100%;
    height: auto;
  }

  view {
    font-size: 14px;
    line-height: inherit;
  }

  /* #endif */

  .text {
    text-align: center;
    font-size: 26rpx;
    margin-top: 10rpx;
  }

  .grid-item-box {
    flex: 1;
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
  }

  .uni-margin-wrap {
    width: 690rpx;
    width: 100%;
    ;
  }

</style>
